import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '../views/login.vue'

Vue.use(VueRouter)

const router = new VueRouter({
  mode: 'history',
  base: import.meta.env.BASE_URL,
  routes: [
    {
      path: '/',
      name: 'login',
      component: login
    },
    {
      path: '/system',
      name: 'system',
      meta:{
        requireAuth: true
      },
      component: () => import('../views/system.vue')
    },
    {
      path: '/404',
      name: 'NotFound',
      meta: {
        title: 'Page not found',
        isLogin: false
      },
      component: () => import('../views/error.vue')
    },
    // 所有未定义路由，全部重定向到404页，必须放在最后
    {
      path: '*',
      redirect: '/404'
    }
  ]
})

export default router
